home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11tl.lha / lbl / hips / sources / scale_geom / pic.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-17  |  3.6 KB  |  109 lines

  1. /*
  2.  * pic.h: definitions for device-independent picture package
  3.  *
  4.  * Paul Heckbert, ph@miro.berkeley.edu    Sept 1988
  5.  *
  6.  * Copyright (c) 1989  Paul S. Heckbert
  7.  * This source may be used for peaceful, nonprofit purposes only, unless
  8.  * under licence from the author. This notice should remain in the source.
  9.  */
  10.  
  11. #ifndef PIC_HDR
  12. #define PIC_HDR
  13.  
  14. /* $Header: pic.h,v 2.1 88/11/01 21:09:58 ph Locked $ */
  15. #include "pixel.h"
  16. #include "window.h"
  17.  
  18. typedef struct {        /* PICTURE PROCEDURE POINTERS */
  19.     char *(*open)(/* name, mode */);
  20.     void (*close)(/* p */);
  21.  
  22.     char *(*get_name)(/* p */);
  23.     void (*clear)(/* p, pv */);
  24.     void (*clear_rgba)(/* p, r, g, b, a */);
  25.  
  26.     void (*set_nchan)(/* p, nchan */);
  27.     void (*set_box)(/* p, ox, oy, dx, dy */);
  28.     void (*write_pixel)(/* p, x, y, v */);
  29.     void (*write_pixel_rgba)(/* p, x, y, r, g, b, a */);
  30.     void (*write_row)(/* p, y, x0, nx, buf */);
  31.     void (*write_row_rgba)(/* p, y, x0, nx, buf */);
  32.  
  33.     int (*get_nchan)(/* p */);
  34.     void (*get_box)(/* p, ox, oy, dx, dy */);
  35.     Pixel1 (*read_pixel)(/* p, x, y */);
  36.     void (*read_pixel_rgba)(/* p, x, y, pv */);
  37.     void (*read_row)(/* p, y, x0, nx, buf */);
  38.     void (*read_row_rgba)(/* p, y, x0, nx, buf */);
  39. } Pic_procs;
  40.  
  41. typedef struct {    /* PICTURE INFO */
  42.     char *dev;        /* device/filetype name */
  43.     Pic_procs *procs;    /* structure of generic procedure pointers */
  44.     char *data;        /* device-dependent data (usually ptr to structure) */
  45. } Pic;
  46.  
  47. #define PIC_LISTMAX 10
  48. extern Pic *pic_list[PIC_LISTMAX];    /* list of known picture devices */
  49. extern int pic_npic;            /* #pics in pic_list, set by pic_init */
  50.  
  51. #define PIC_UNDEFINED PIXEL_UNDEFINED   /* used for unknown nchan */
  52.  
  53. Pic    *pic_open(/* name, mode */);
  54. Pic    *pic_open_dev(/* dev, name, mode */);
  55. void    pic_close(/* p */);
  56.  
  57. #define     pic_get_name(p) \
  58.     (*(p)->procs->get_name)((p)->data)
  59. #define     pic_clear(p, pv) \
  60.     (*(p)->procs->clear)((p)->data, pv)
  61. #define     pic_clear_rgba(p, r, g, b, a) \
  62.     (*(p)->procs->clear_rgba)((p)->data, r, g, b, a)
  63.  
  64. #define     pic_set_nchan(p, nchan) \
  65.     (*(p)->procs->set_nchan)((p)->data, nchan)
  66. #define     pic_set_box(p, ox, oy, dx, dy) \
  67.     (*(p)->procs->set_box)((p)->data, ox, oy, dx, dy)
  68.  
  69. #define     pic_write_pixel(p, x, y, pv) \
  70.     (*(p)->procs->write_pixel)((p)->data, x, y, pv)
  71. #define     pic_write_pixel_rgba(p, x, y, r, g, b, a) \
  72.     (*(p)->procs->write_pixel_rgba)((p)->data, x, y, r, g, b, a)
  73. #define     pic_write_row(p, y, x0, nx, buf) \
  74.     (*(p)->procs->write_row)((p)->data, y, x0, nx, buf)
  75. #define     pic_write_row_rgba(p, y, x0, nx, buf) \
  76.     (*(p)->procs->write_row_rgba)((p)->data, y, x0, nx, buf)
  77.  
  78. #define     pic_get_nchan(p) \
  79.     (*(p)->procs->get_nchan)((p)->data)
  80. #define     pic_get_box(p, ox, oy, dx, dy) \
  81.     (*(p)->procs->get_box)((p)->data, ox, oy, dx, dy)
  82.  
  83. #define     pic_read_pixel(p, x, y) \
  84.     (*(p)->procs->read_pixel)((p)->data, x, y)
  85. #define     pic_read_pixel_rgba(p, x, y, pv) \
  86.     (*(p)->procs->read_pixel_rgba)((p)->data, x, y, pv)
  87. #define     pic_read_row(p, y, x0, nx, buf) \
  88.     (*(p)->procs->read_row)((p)->data, y, x0, nx, buf)
  89. #define     pic_read_row_rgba(p, y, x0, nx, buf) \
  90.     (*(p)->procs->read_row_rgba)((p)->data, y, x0, nx, buf)
  91.  
  92.  
  93. void    pic_init(/* p */);
  94. void    pic_catalog();
  95. #define pic_get_dev(p) (p)->dev
  96. Pic    *pic_load(/* name1, name2 */);
  97. void    pic_save(/* p, name */);
  98. void    pic_copy(/* p, q */);
  99. void    pic_set_window(/* p, win */);
  100. void    pic_write_block(/* p, x0, y0, nx, ny, buf */);
  101. void    pic_write_block_rgba(/* p, x0, y0, nx, ny, buf */);
  102. Window    *pic_get_window(/* p, win */);
  103. void    pic_read_block(/* p, x0, y0, nx, ny, buf */);
  104. void    pic_read_block_rgba(/* p, x0, y0, nx, ny, buf */);
  105.  
  106. char    *pic_file_dev(/* file */);
  107.  
  108. #endif
  109.